<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script type="text/javascript">
        let docElement = document.documentElement; //获取根元素
        function setRemUnit() { //设置rem的单位px 默认是16px
            //docElement.clientWidth=375 docElement.style.fontSize=37.5px
            docElement.style.fontSize = docElement.clientWidth / 10 + 'px';
        }
        setRemUnit();
        window.addEventListener('resize', setRemUnit);
    </script>
    <title>项目实战</title>
</head>

<body>
    <div id="root"></div>
</body>

</html>